/***************************************************************
 *  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
 *  All rights reserved.
 *
 *  This file is part of the GroupMe! Project. Source code of 
 *  this project is closed and redistribution of this code is
 *  prohibited. 
 *  
 *  Contact: http://www.groupme.net
 *
 *  This copyright notice MUST APPEAR in all copies of the file!
 ***************************************************************/
package net.groupme.model.dao.mem;

import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;

import net.groupme.exceptions.UpdateFailedException;
import net.groupme.model.Group;
import net.groupme.model.ResourceVisualization;
import net.groupme.model.Style;
import net.groupme.model.User;
import net.groupme.model.dao.GroupVisualizationDAO;

/**
 * created on 21.02.2008
 * 
 * This class is a Memory persitent implemenation of a Group Visualisation
 * 
 * @author Patrick Siehndel <a href="mailto:patrick.siehndel@gmx.de">patrick.siehndel@gmx.de</a>
 * 
 * @version $Revision: 1.6 $ $Date: 2008-06-13 17:39:56 $
 */
public class GroupVisualizationDAOMemImpl implements GroupVisualizationDAO {

	private Collection<ResourceVisualization> resourceVisualisation = new ArrayList<ResourceVisualization>();;
	private Collection<User> users = new ArrayList<User>();
	private String description;
	private Group group;
	private String id = "-1";
	private String name;
	private Style style;
	private String lable;
	private String thumbnail = null;

	
	public GroupVisualizationDAOMemImpl(Group group, String id) {
		super();
		this.group = group;
		this.description = group.getDescription();
		this.name = "Visualization of " +  group.getName();
		this.id = id;
	}
	


	public GroupVisualizationDAOMemImpl() {
	}
	
	public GroupVisualizationDAOMemImpl(String name, String description, Group group) {
		this.name = name;
		this.description = description;
		this.group = group;
	}


	public void addResourceVisualization(ResourceVisualization resourceVisualization) {
		this.resourceVisualisation.add(resourceVisualization);
	}

	public void addUser(String role, User user) {
		this.users.add(user);

	}

	public Group getGroup() {
		return this.group;
	}

	public String getName() {
		return this.name;
	}

	public Collection<ResourceVisualization> getResourceVisualizations() {
		return this.resourceVisualisation;
	}

	public Style getStyle() {
		return this.style;
	}

	public Collection<User> getUser(String role) {
		return this.users;
	}

	public Collection<User> getUsers() {
		return this.users;
	}

	public void removeResourceVisualization(
			ResourceVisualization resourceVisualization) {
		this.resourceVisualisation.remove(resourceVisualization);

	}

	public void removeUser(User user) {
		this.users.remove(user);

	}

	public void setGroup(Group group) {
		this.group = group;

	}

	public void setName(String name) {
		this.name = name;

	}

	public void setStyle(Style style) {
		this.style = style;

	}

	public String getDescription() {
		return this.description;
	}

	public String getId() {
		return this.id;
	}

	public String getLabel() {
		return this.lable;
	}

	public URI getURI() {
		return null;
	}

	public void setDescription(String description) {
		this.description = description;

	}

	public void setLabel(String label) {
		this.lable = label;
	}

	public String getThumbnail() {
		return this.thumbnail;
	}

	public void setThumbnail(String url) throws UpdateFailedException {
		this.thumbnail = url;
	}



	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return this.getName() + ": " + this.description;
	}

}
